/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package koor.entity;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;

/**
 *
 * @author Admin
 */
@MappedSuperclass
public abstract class Person extends AbstractEntity{
    
    @Column(name = "first_name")
    protected String firstName;
    
    @Column(name = "second_name")
    protected String secondName;
    
    @Column(name = "patronymic")
    protected String patronymic;

    public Person() {
    }

    public Person(String firstName, String secondName, String patronymic) {
        this.firstName = firstName;
        this.secondName = secondName;
        this.patronymic = patronymic;
    }

    public Person(String firstName, String secondName, String patronymic, int id) {
        super(id);
        this.firstName = firstName;
        this.secondName = secondName;
        this.patronymic = patronymic;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getPatronymic() {
        return patronymic;
    }

    public void setPatronymic(String patronymic) {
        this.patronymic = patronymic;
    }

    public String getSecondName() {
        return secondName;
    }

    public void setSecondName(String secondName) {
        this.secondName = secondName;
    }
    
    public String getShortName(){
        return secondName + firstName.charAt(0)+ "." + patronymic.charAt(0)+ ".";
    }

    @Override
    public String toString() {
        return secondName + " " + firstName + " " + patronymic;
    }
    
}
